ethicalads: follow Material/Zensical dark mode - #716
Conversation
The EthicalAds client's adaptive-css mode doesn't recognize the data-md-color-scheme attribute, so ads stayed light on dark pages. Toggle the client's dark class to match, and observe changes. Claude-Session: https://claude.ai/code/session_01Y4ChPUE9B1c2E2nyww8fqv
It seem this should be implemented in ethical ad client instead so the |
|
One possibility since there is an unlimited number of attributes where the light/dark mode could be set is to set the attribute on the ad placement (eg. |
|
Could be in either, we should just fix it somewhere because it currently looks pretty bad :( I really wish there were standards here. :( |
|
Unfortunately, there isn't a standard here. Looking more closely at what Zensical is doing, they're setting
|
Ads on Material for MkDocs and Zensical sites always render in light mode, even when the page itself is dark — reported on https://goss.readthedocs.io/en/stable/ (Zensical with an auto light/dark palette) with a dark system preference.
Root cause: we add the
adaptive-cssclass to the placement, but the EthicalAds client's adaptive mode only reacts to markers it knows onhtml/body— thedark/autoclasses,data-theme, ordata-bs-theme. Material-family themes (Material for MkDocs, Zensical, sphinx-immaterial) signal dark mode withdata-md-color-scheme="slate"instead, so no selector ever matches and the ad keeps the light default.Rather than teaching the ad client about a theme-specific attribute, this handles it on the addons side, where the per-theme knowledge already lives: sync the client's documented
darkclass withdata-md-color-scheme, observing attribute changes so the ad also follows the palette toggle and OS preference switches live. Themes without the attribute are unaffected.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y4ChPUE9B1c2E2nyww8fqv